package com.dycloud.project.utils;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * @ClassName: UniqueUsernameGenerator
 * @description:
 * @author: renhang
 * @create: 2025-07-05 16:52
 */
public class UniqueUsernameGenerator {
    
    private static final String[] ADJECTIVES = {"happy", "clever", "brave", "gentle", "quick", "wise"};
    
    private static final String[] NOUNS = {"lion", "tiger", "eagle", "bear", "wolf", "fox"};
    
    private static final Set<String> usedNames = new HashSet<>();
    
    private static final Random random = new Random();
    
    public static String generate() {
        String username;
        do {
            String adj = ADJECTIVES[random.nextInt(ADJECTIVES.length)];
            String noun = NOUNS[random.nextInt(NOUNS.length)];
            int num = random.nextInt(9000) + 100;
            username = adj + noun + num;
        } while (usedNames.contains(username));
        
        usedNames.add(username);
        return username;
    }
}
